﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlDoiGiaHangNhap.ascx.cs" Inherits="UserControl_ControlDoiGiaHangNhap" %>
<%@ Import Namespace="webapp4U" %>
 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register src="uscMsgBox.ascx" tagname="uscMsgBox" tagprefix="uc1" %>

<style type="text/css">

.AutoExtender
        {
            border: solid 1px #006699;
            line-height: 20px;
            padding: 10px;
            background-color: White;
            margin-left:10px;
            width: 300px;
        }
        .AutoExtenderList
        {
            border-bottom: dotted 1px #006699;
            cursor: pointer;
            color: Maroon;
        }
        .AutoExtenderHighlight
        {
            color: White;
            background-color: #006699;
            cursor: pointer;
        }
       
       #divwidthMaHang
       {
       	width: auto !important;  
       }
        #divwidthMaHang div
       {
       	width: auto !important;  
       } 
</style>
<script type="text/javascript">
    function pageLoad() {

        //bắt buộc nhập kiểu số
        $("#<%= txtOldPrice.ClientID %>").numeric({ allow: "." });
        //bắt buộc nhập kiểu số
        $("#<%= txtNewPrice.ClientID %>").numeric({ allow: "." });

        //ngày hiệu lực
        $(function () {
            $("#<%= txtDate.ClientID %>").datePicker(
		{
		    clickInput: true,
		    startDate: new Date().asString()
		}
	    );
        });

        $("#<%= imgBtnAdd.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnSave.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnDelete.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnFind.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }

    }
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
     <div class="direct_container_right_titletop">
                     Đổi giá hàng nhập
                </div>
                 <hr />
                <!-- Button chuc nang-->
                <div class="direct_container_main">
                    <asp:ImageButton ID="imgBtnAdd" onclick="imgBtnAdd_Click" CausesValidation="false" ImageUrl="~/Images/add.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnSave" onclick="imgBtnSave_Click" ImageUrl="~/Images/save.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnDelete" onclick="imgBtnDelete_Click" ImageUrl="~/Images/delete.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnFind" onclick="imgBtnFind_Click" CausesValidation="false" ImageUrl="~/Images/find.png" Width="32px" Height="32px" runat="server" />

                </div>
                <!-- End Button chuc nang-->
                <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" 
            BackColor="#CCFFFF" Font-Names="Arial"  Height="500px" 
            Width="100%">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Nhập thông tin" TabIndex="0">
                 <ContentTemplate>
                    <!-- Content main-->
                <div class="direct_container_main">
                    <div class="direct_container_form_right">
                        <table border="0" width="100%">
                            <tr>
                                <td align="right"><p class="direct_label">Số NV</p></td>
                                <td align="left">
                               <asp:TextBox ID="txtSoNV" ReadOnly="True" CssClass="input_code" 
                                        runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td align="right"><p class="direct_label">Ngày hiệu lực</p></td>
                                <td align="left">
                                 <asp:TextBox ID="txtDate" CssClass="input_code" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="10%" align="right"><p class="direct_label">Mã hàng</p></td>
                                <td width="90%" align="left">
                                   <asp:TextBox ID="txtMaHang" CssClass="input_code" runat="server" AutoPostBack="True" 
                                        ontextchanged="txtMaHang_TextChanged"></asp:TextBox>



                                     <div id="divwidthMaHang" style="overflow:scroll;height:150px;display:none"></div>
                                            <cc1:AutoCompleteExtender ID="txtMaHang_AutoCompleteExtender" 
                                                runat="server"
                                                ServiceMethod="GetMatHangInfo" ServicePath="~/Webservice/WebServiceDRM.asmx" 
                                                TargetControlID="txtMaHang"
                                                MinimumPrefixLength="1" 
                                                CompletionInterval="10"
                                                CompletionSetCount="12"                             
                                                CompletionListCssClass="AutoExtender"
                                                CompletionListItemCssClass="AutoExtenderList"
                                                CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
                                                CompletionListElementID="divwidthMaHang" DelimiterCharacters="" 
                                        Enabled="True"></cc1:AutoCompleteExtender>



                                     <asp:TextBox ID="txtTenHang" CssClass="input_full" runat="server"></asp:TextBox>
                                </td>
                            </tr>

                            <tr>
                                <td align="right"><p class="direct_label">Giá cũ</p></td>
                                <td align="left">
                                 <asp:TextBox ID="txtOldPrice" CssClass="input_code" runat="server"></asp:TextBox>
                                   &nbsp;&nbsp;
                                    <span class="direct_label">Giá mới</span>&nbsp;<asp:TextBox ID="txtNewPrice" CssClass="input_code" runat="server"></asp:TextBox>
                                     <asp:Button ID="btAdd" runat="server" CssClass="direct_bt_search" Text="Thêm" 
                                        onclick="btAdd_Click" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                               <asp:GridView ID="grvProduct" runat="server" AutoGenerateColumns="False" 
                                onrowcancelingedit="grvProduct_RowCancelingEdit" 
                    onrowediting="grvProduct_RowEditing" onrowupdating="grvProduct_RowUpdating" 
                    onrowdeleting="grvProduct_RowDeleting" DataKeyNames="Mã hàng" EnableModelValidation="True"><Columns>
<asp:TemplateField HeaderText="Stt"><HeaderTemplate>
                                                                    STT
                                                                
                                         
</HeaderTemplate>
<ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Mã hàng"><HeaderTemplate>
                                                                    Mã hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                             <asp:Label ID="lblMaHang" runat="server" Text='<%# Eval("Mã hàng")%>'></asp:Label>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Tên hàng"><HeaderTemplate>
                                                                    Tên hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  <asp:Label ID="lblTenHang" runat="server" Text='<%# Eval("Tên hàng")%>'></asp:Label>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Giá cũ">
<HeaderTemplate>
                                                                    Giá cũ
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
           <asp:Label ID="lblGiaCu" runat="server" Text='<%# Eval("Giá cũ")%>'></asp:Label>     
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Giá mới">
<HeaderTemplate>
                                                                    Giá mới
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
          <asp:Label ID="lblGiaMoi" runat="server" Text='<%# Eval("Giá mới")%>'></asp:Label>   
                                                                
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtGM" CssClass="input_code" Text=' <%# Eval("Giá mới")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:CommandField CausesValidation="False" HeaderText="Sửa" 
                                                                 ShowEditButton="True" ButtonType="Image"
                                                                EditImageUrl="~/images/repair_bt.png" EditText="Sửa" 
                                                                CancelImageUrl="~/images/exit_bt.png" CancelText="Thoát" UpdateText="Cập nhập" 
                                                                UpdateImageUrl="~/images/update_bt.png" >
<ControlStyle Height="25px" Width="25px" />

<ItemStyle Height="25px" Width="25px" />
</asp:CommandField>
<asp:CommandField  ButtonType="Image" DeleteText="Xóa" 
                                                                DeleteImageUrl="~/images/delete.png" CausesValidation="False" HeaderText="Xóa" 
                                                                 ShowDeleteButton="True" >
<ControlStyle Height="25px" Width="25px" />

<ItemStyle Height="25px" Width="25px" />
</asp:CommandField>
</Columns>
</asp:GridView>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <!-- EndContent main-->
                 </ContentTemplate>
            </cc1:TabPanel>
             <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Tìm kiếm" TabIndex="1">
                <ContentTemplate>
                         <!-- Content search -->
                <div class="direct_container_main">
                     <div class="direct_container_form_right">
                         <table border="0" width="100%">
                                <tr><td colspan="2"><p class="direct_legend">Nhập thông tin cần tìm</p></td></tr>
                               
                                    <tr>
                                        <td colspan="2">
                                         <asp:GridView ID="grvSearch" runat="server" PageSize="10" AutoGenerateColumns="False" 
                                                        DataKeyNames="docno" EnableModelValidation="True" onpageindexchanging="grvSearch_PageIndexChanging"
                                                        onrowcommand="grvSearch_RowCommand">
                                                        <Columns>
                                                            <asp:TemplateField HeaderText="Stt">
                                                                <HeaderTemplate>
                                                                    STT
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Số nghiệp vụ">
                                                                <HeaderTemplate>
                                                                    Số nghiệp vụ
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                   
                                                                    <asp:Label ID="lblSoNV" runat="server" Text='<%# Eval("docno")%>'></asp:Label>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Ngày chứng từ">
                                                                <HeaderTemplate>
                                                                    Ngày chứng từ
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Eval("docdate")%>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                           
                                                             <asp:TemplateField>
                                                                 <ItemTemplate>
                                                                    <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" 
                                                                    CommandName="chon" Height="20px" ImageUrl="~/Images/check.png" />
                                                                </ItemTemplate>
                                                                <ControlStyle BackColor="White" BorderColor="White" />
                                                                <FooterStyle BackColor="White" BorderColor="White" />
                                                                <HeaderStyle BackColor="White" BorderColor="White" />
                                                                <ItemStyle BackColor="White" BorderColor="White" />
                                                            </asp:TemplateField>
                                                        </Columns>
                                                    </asp:GridView>
                                        
                                        </td>
                                    </tr>


                         </table>
                    </div>

                </div>
                <!-- End Content search -->
           </div>
                </ContentTemplate>
            </cc1:TabPanel>
            </cc1:TabContainer>
    </ContentTemplate>
</asp:UpdatePanel>
<uc1:uscMsgBox ID="uscMsgBox1" runat="server" />